package com.fowo.api.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fowo.api.common.annotaion.TitleField;
import com.fowo.api.sys.entity.enums.SysTaskType;
import com.fowo.api.sys.model.SysTaskData;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 系统任务
 */
@EqualsAndHashCode(callSuper = true)
@Schema(title = "系统任务")
@TableName(value = "sys_task", autoResultMap = true)
@Data
public class SysTask extends SysBase {

        @TitleField
        @Schema(title = "任务标题")
        private String title;

        @Schema(title = "任务编码")
        private String code;

        @Schema(title = "是否启用计划")
        private Boolean plan;

        @Schema(title = "计划的最后一个执行者")
        private String planWorkerId;

        @Schema(title = "执行次数")
        private Long executions;

        @Schema(title = "最后执行时间")
        private Date lastExecutionTime;

        @Schema(title = "最后执行同步标识")
        private String lastExecutionSyncId;

        @Schema(title = "下次执行时间")
        private Date nextExecutionTime;

        @Schema(title = "任务说明")
        private String description;

        @Schema(title = "状态")
        private Integer status;

        @Schema(title = "任务类型")
        private SysTaskType type;

        @Schema(title = "配置数据")
        @TableField(typeHandler = JacksonTypeHandler.class)
        private SysTaskData data;

        private Long xxlInfoId;
}
